﻿namespace Anley.DomainDrivenDesign.Contract.DomainAdapter;

/// <summary>
/// 选择器选项
/// </summary>
/// <typeparam name="TValue"></typeparam>
public class SelectorOption<TValue>
{
    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="label">文本</param>
    /// <param name="value">值</param>
    /// <param name="image">图片</param>
    public SelectorOption(
        string label,
        TValue value,
        string? image = null)
    {
        Label = label;
        Value = value;
        Image = image;
    }

    public string Label { get; set; }

    public TValue Value { get; set; }

    public string? Image { get; set; }
}

/// <summary>
/// 选择器选项集合
/// </summary>
/// <typeparam name="TValue"></typeparam>
public class SelectorOptions<TValue>
    : List<SelectorOption<TValue>>
{
    /// <summary>
    /// 初始化选择器选项集合
    /// </summary>
    public SelectorOptions()
    {
    }

    /// <summary>
    /// 初始化选择器选项集合
    /// </summary>
    /// <param name="selectorOptions"></param>
    public SelectorOptions(
        List<SelectorOption<TValue>> selectorOptions)
    {
        Clear();
        AddRange(selectorOptions);
    }
}